# 使用官方的Node镜像作为基础镜像
FROM node:16.19.0 as build-stage

# 设置工作目录
WORKDIR /app

# 复制项目文件到工作目录
COPY . .

# 删除依赖模块
RUN rm -rf node_modules

# 设置淘宝镜像
RUN npm config set registry https://registry.npm.taobao.org/

# 安装项目依赖
RUN npm install

# 构建项目
RUN npm run build

# 使用Nginx镜像作为最终的镜像
FROM nginx:1.21.3

# 将构建好的静态文件复制到Nginx的默认站点目录
COPY --from=build-stage /app/dist/ /usr/share/nginx/html

COPY nginx.conf /etc/nginx

RUN rm -rf /etc/nginx/conf.d/*

# docker build --platform linux/amd64 -t micro-lowcode .
# docker run -p 8848:8848 micro-lowcode
# docker tag  micro-lowcode 192.168.0.232/dmd/micro-lowcode:0.0.1
# docker push 192.168.0.232/dmd/micro-lowcode:0.0.1
